const TOKEN_KEY = 'hk-token'
// 存储Token
export const setToken = (TOKEN_KEY, value) => {
  if (typeof value === 'object') {
    value = JSON.stringify(value)
  }
  localStorage.setItem(TOKEN_KEY, value)
}

// 获取Token
export const getToken = (TOKEN_KEY) => {
  try {
    return JSON.parse(localStorage.getItem(TOKEN_KEY))
  } catch (error) {
    return localStorage.getItem(TOKEN_KEY)
  }
}

// 移除Token
export const removeToken = () => {
  localStorage.removeItem(TOKEN_KEY)
}
